<div class="layui-form" lay-filter="layuiadmin-form-useradmin" style="padding: 20px 0 0 0;">
    <div class="layui-form-item">
        <label class="layui-form-label">商品标题</label>
        <div class="layui-input-inline">
            <script template type="text/html">
                <input type="text" name="title" value="{{ d.params.title || '' }}" lay-verify="required"
                       placeholder="请输入标题" autocomplete="off" class="layui-input">
                <input type="hidden" name="id" value="{{ d.params.id || '' }}">
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">商品分类</label>
        <div class="layui-input-inline">
            <script template type="text/html">
                <input type="text" name="category" value="{{ d.params.category || '' }}" lay-verify="required"
                       placeholder="请输入类别" autocomplete="off" class="layui-input">
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">单价</label>
        <div class="layui-input-inline">
            <script template type="text/html">
                <input type="text" name="price" value="{{ d.params.price || '' }}" lay-verify="required"
                       placeholder="请输入单价" autocomplete="off" class="layui-input">
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">库存</label>
        <div class="layui-input-inline">
            <script template type="text/html">
                <input type="text" name="stock" value="{{ d.params.stock || '' }}" lay-verify="required"
                       placeholder="请输入库存" autocomplete="off" class="layui-input">
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">店铺编号</label>
        <div class="layui-input-inline">
            <script template type="text/html">
                <input type="text" name="shopId" value="{{ d.params.shopId || '' }}" lay-verify="required"
                       placeholder="请输入店铺编号" autocomplete="off" class="layui-input">
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">商品描述</label>
        <div class="layui-input-inline">
            <script template type="text/html">
                <input type="text" name="desc" value="{{ d.params.desc || '' }}" lay-verify="required"
                       autocomplete="off" class="layui-input">
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">商品样图</label>
        <div class="layui-input-inline">
            <script template type="text/html">
                <input type="text" name="itemImagePath" value="{{ d.params.item_image_path || '' }}"
                       lay-verify="required" placeholder="请上传图片" autocomplete="off" class="layui-input">
            </script>
        </div>
        <button class="layui-btn" id="layuiadmin-upload-goods" style="float: left;" type="button">上传图片</button>
    </div>
    <div class="layui-form-item" lay-filter="state">
        <label class="layui-form-label">选择状态</label>
        <div class="layui-input-block">
            <script template type="text/html">
                <input type="radio" name="state" value="1" title="正常" {{ d.params.state=== '1' ? 'checked' : '' }}>
                <input type="radio" name="state" value="2" title="下架" {{ d.params.state=== '2' ? 'checked' : '' }}>
                <input type="radio" name="state" value="3" title="已删除" {{ d.params.state=== '3' ? 'checked' : '' }}>
            </script>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-inline">
            <input class="layui-btn" lay-filter="LAY-goods-submit" lay-submit type="button" value="确认">
        </div>
    </div>
</div>

<script>
    layui.use(['admin', 'form', 'upload'], function () {
        var $ = layui.$
            , form = layui.form
            , upload = layui.upload;

        //上传头像
        upload.render({
            elem: '#layuiadmin-upload-goods'
            , url: '../upload'
            , accept: 'images'
            , method: 'post'
            , acceptMime: 'image/*'
            , done: function (res) {
                $(this.item).prev("div").children("input").val(res.data.src)
            }
        });
    })
</script>